var toastHtml = '<div class="toast_box"></div>'
$('body').append(toastHtml);

$('.toast_box').css({
    position: 'fixed',
    top: '20px',
    width: '100%',
    zIndex: 9999
})
//队列弹窗
var popIndex = 2020;
var popDelIndex = 2021;

function showToast(message, bgcolor) {
    popIndex++;
    if (!message) {
        message = '未知操作~'
    }
    if (!bgcolor) {
        bgcolor = '#e6a23c';
    }
    $(".toast_box").append("<div class='toast_content' index=" + popIndex + " >" + message + "</div>");
    $(".toast_content").css({
        margin: '0 auto',
        width: '260px',
        lineHeight: '30px',
        marginBottom: ' 5px',
        borderRadius: '6px',
        // backgroundColor: '#67c23a',
        fontSize: '16px',
        transition: '0.5s',
        opacity: '0.9',
        textAlign: 'center',
        color: '#fff'
    })
   
    $(".toast_box .toast_content[index=" + popIndex + "]").css({
        "background-color": bgcolor
    });
    var time = setTimeout(function () {
        $(".toast_box .toast_content[index=" + popDelIndex + "]").show();
        clearTimeout(time);
        time = "";
        $(".toast_box .toast_content[index=" + popDelIndex + "]").hide().remove();
        popDelIndex++;
    }, 2500);
}